package ui;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

class BackgroundImagePanel extends JPanel {
    private static final long serialVersionUID = 1L;
    private Image img;

    public BackgroundImagePanel(String img) {
	this(new ImageIcon(img).getImage());
    }
    
    public void setSize2(Dimension size) {
	setPreferredSize(size);
	setMinimumSize(size);
	setMaximumSize(size);
	setSize(size);
    }

    public BackgroundImagePanel(Image img) {
	this.img = img;
	// Dimension size = new Dimension(img.getWidth(null),
	// img.getHeight(null));
	
	setLayout(null);
    }

    public void paintComponent(Graphics g) {
	g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
    }

}
